package org.unv.mozhi.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.unv.mozhi.dao.MsgDAO;
import org.unv.mozhi.entity.MMsg;

@Service
public class MozhiServiceImpl implements MozhiService {

	@Autowired
	private MsgDAO msgDAO;

	@Transactional
	public void addMessage(MMsg message) {
		msgDAO.create(message);
	}

	@Transactional
	public List<MMsg> fetchMessage(String filter) {
		return msgDAO.listMessage();
	}

	@Transactional
	public void removeMessage(Integer id) {
		MMsg msg=msgDAO.getMessage(id);
		msgDAO.delete(msg);
	}
}
